#ifndef _CONFIG_H
#define _CONFIG_H

#define CONSOLE_HOME "/home/Tim"
#define T_CONFIG_ROOT_PATH "/cfg"
#define T_CONFIG_DEFAULT_CFG_ROOT_PATH CONSOLE_HOME "/default_cfg_root"

#define CONFIG_MAX_LINE_IN_FILE (400)
#define CONFIG_MAX_BYTE_PER_LINE (200)

#ifndef OPT_DIR
#define OPT_DIR "/opt/Tim"
#endif

#define CONSOLE_CMD_ARGS_NUM (16)

typedef struct _CONSOLE_CMD_PARAM_S
{
	char abyCmd[32];
	int nArgsNum;
	char abyArgs[CONSOLE_CMD_ARGS_NUM][32];
} CONSOLE_CMD_PARAM_S;

typedef int (*CONSOLE_CMD_CB)(CONSOLE_CMD_PARAM_S *, char *);

typedef enum
{
	CONFIG_TYPE_NONE = -1,
	CONFIG_TYPE_INT32,
	CONFIG_TYPE_UINT32,
	CONFIG_TYPE_INT16,
	CONFIG_TYPE_UINT16,
	CONFIG_TYPE_INT8,
	CONFIG_TYPE_UINT8,
	CONFIG_TYPE_FLOAT,
	CONFIG_TYPE_DOUBLE,
	CONFIG_TYPE_STRING,
} CONFIG_TYPE_E;

typedef struct _CONFIG_RECORD_S
{
	char *pbyKey;
	void *pvValue;
	CONFIG_TYPE_E eType;
} CONFIG_RECORD_S;

int Config_LoadFile(char *pbyFile, CONFIG_RECORD_S *pstRecords, int nRecordsNum);
int Config_PutFile(char *pbyFile, CONFIG_RECORD_S *pstRecords, int nRecordsNum);

#endif
